package cn.tedu.review;

/**
 * @Author 金帮嘉诚
 * @Date 2021-06-08 周二 19:59
 */
/*本类用于复习面向对象*/
    /*面向对象第一个特性：封装*/
    /*使用private关键字进行封装 ；私有成员变量的使用*/
public class TestOOP {
    public static void main(String[] args) {
        Phone p1=new Phone();
        System.out.println("p1.brand = " + p1.brand);
        System.out.println("p1.color = " + p1.color);
        System.out.println("p1.price = " + p1.price);
        System.out.println("p1.size = " + p1.size);
        p1.setBrand("Brand1");
        p1.setColor("Color1");
        p1.setPrice(111);
        p1.setSize(1111);
        System.out.println("Setting...");
        System.out.println("p1.brand = " + p1.brand);
        System.out.println("p1.color = " + p1.color);
        System.out.println("p1.price = " + p1.price);
        System.out.println("p1.size = " + p1.size);
        p1.call();
    }
}
//构造方法：修饰符 方法名【与类同名】（参数列表）{方法体}
class Phone{
    String brand;
    String color;
    double price;
    double size;

    public void call(){
        System.out.println("Calling~~~~~~~~~~~~~~~~~");
        eat();
    }
    private void eat(){
        System.out.println("eating");
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getSize() {
        return size;
    }

    public void setSize(double size) {
        this.size = size;
    }
}
